<template>
  <q-page class="q-pa-md">
    <div class="row items-center">
      <div class="q-pb-md text-h5">
        {{ pageTitle }}
        <span class="text-subtitle1">列表</span>
      </div>
      <q-space></q-space>
      <search-bar-toggle-btn v-model="searchBarVisibility"></search-bar-toggle-btn>
    </div>
    <!--查询-->
    <div class="q-pa-sm shadow-2 q-mb-md items-center" v-show="searchBarVisibility">
      <div class="row q-col-gutter-sm q-mb-sm">
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">仓库</div>
          <div class="col-8">
            <simple-filter-select :options="$d.whDropdownList" :readonly="listDataLoadingState" :use-filter="false"
              option-label="whName" option-value="whId" v-model="fpsReq.whId" @update:model-value="onWhChanged" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">储区</div>
          <div class="col-8">
            <simple-filter-select v-model="fpsReq.zoneId"
              :options="fpsReq.whId ? $d.zoneDropdownListByWhId : $d.zoneDropdownList" :use-filter="false"
              :auto-select-single-option="false" :readonly="listDataLoadingState" option-label="zoneName"
              option-value="zoneId" @update:model-value="onZoneChanged" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">储位</div>
          <div class="col-8">
            <simple-filter-select v-model="fpsReq.locId" :use-filter="false"
              :auto-select-single-option="false" :readonly="listDataLoadingState"
              option-label="loc"
              option-value="locId"
              :options="$d.locDropdownList"
              server-side-url="/wms/basic/loc/get-loc-simple-list"
              search-content-field="loc"
              resp-data-field="locs"
              :req-params="{pageNo:1,pageSize:10,whId:fpsReq.whId,zoneId:fpsReq.zoneId}"
            />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">货主</div>
          <div class="col-8">
            <simple-filter-select :options="$d.storerDropdownList" option-label="abbrName" option-value="mfId"
              v-model="fpsReq.storerId" :auto-select-single-option="false" :readonly="listDataLoadingState"
              @update:model-value="onStorerChanged" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">料号</div>
          <div class="col-8">
            <wm-sku-selector :company-id="fpsReq.companyId" :sku="fpsReq.sku" @sku-selected="onSkuSelected"
              v-model="fpsReq.skuId" :storer-id="fpsReq.storerId" :readonly="listDataLoadingState"></wm-sku-selector>
          </div>
        </div>
        <div v-if="$d.actualFieldShown.lot && fpsInfo.filtersInfo?.lot?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">批号</div>
          <div class="col-8">
            <q-input v-model="fpsReq.lot" :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label clearable :readonly="listDataLoadingState" />
          </div>
        </div>
        <div v-if="$d.actualFieldShown.lpn && fpsInfo.filtersInfo?.lpn?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">栈板</div>
          <div class="col-8">
            <q-input v-model="fpsReq.lpn" :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label clearable :readonly="listDataLoadingState" />
          </div>
        </div>
        <div v-if="$d.actualFieldShown.ifShowZeroInvItem && fpsInfo.filtersInfo?.ifShowZeroInvItem?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">显示已出库存</div>
          <div class="col-8">
            <q-toggle v-model="fpsReq.ifShowZeroInvItem" :disable="listDataLoadingState" dense
              @update:model-value="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.receivedDtBegin?.show">
          <div class="col-4 text-right searchbar-label">入库日期从</div>
          <div class="col-8">
            <easy-input v-model="fpsReq.receivedDtBegin" :append-icon-show="true" :use-date-picker="true"
              :use-five-minute-precision="true" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.receivedDtEnd?.show">
          <div class="col-4 text-right searchbar-label">入库日期至</div>
          <div class="col-8">
            <easy-input v-model="fpsReq.receivedDtEnd" :append-icon-show="true" :use-date-picker="true"
              :use-five-minute-precision="true" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.expiredDtBegin?.show">
          <div class="col-4 text-right searchbar-label">有效期从</div>
          <div class="col-8">
            <easy-input v-model="fpsReq.expiredDtBegin" :append-icon-show="true" :use-date-picker="true"
              :use-five-minute-precision="true" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.expiredDtEnd?.show">
          <div class="col-4 text-right searchbar-label">有效期至</div>
          <div class="col-8">
            <easy-input v-model="fpsReq.expiredDtEnd" :append-icon-show="true" :use-date-picker="true"
              :use-five-minute-precision="true" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.dateCode?.show">
          <div class="col-4 text-right searchbar-label">制造日期</div>
          <div class="col-8">
            <q-input v-model="fpsReq.dateCode" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.coo?.show">
          <div class="col-4 text-right searchbar-label">产地</div>
          <div class="col-8">
            <simple-filter-select :options="$d.cooDropdownList" option-value="codeValue"
              :option-label="(item) => item.codeName2 + '(' + item.codeName1 + ')'"
              v-model="fpsReq.coo" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.packageType?.show">
          <div class="col-4 text-right searchbar-label">包装形态</div>
          <div class="col-8">
            <simple-filter-select :options="fx.lst.packageTypeDropdownList"
              v-model="fpsReq.packageType" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.inboundType?.show">
          <div class="col-4 text-right searchbar-label">入库方式</div>
          <div class="col-8">
            <simple-filter-select :options="$d.inboundTypeDropdownList"
              v-model="fpsReq.inboundType" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.vLot?.show">
          <div class="col-4 text-right searchbar-label">外部批号</div>
          <div class="col-8">
            <q-input v-model="fpsReq.vLot" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.qtyPEa?.show">
          <div class="col-4 text-right searchbar-label">单件装量</div>
          <div class="col-8">
            <q-input v-model="fpsReq.qtyPEa" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.qtyPCase?.show">
          <div class="col-4 text-right searchbar-label">每箱数量</div>
          <div class="col-8">
            <q-input v-model="fpsReq.qtyPCase" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.qtyPIp?.show">
          <div class="col-4 text-right searchbar-label">每盒数量</div>
          <div class="col-8">
            <q-input v-model="fpsReq.qtyPIp" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.qtyPIip?.show">
          <div class="col-4 text-right searchbar-label">每内盒数量</div>
          <div class="col-8">
            <q-input v-model="fpsReq.qtyPIip" :hide-bottom-space="true" :readonly="listDataLoadingState"
              clearable dense :maxlength="30" outlined square stack-label @focus="fx.ui.select"
              @keyup.enter="loadListData(2)" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr01?.show">
          <div class="col-4 text-right searchbar-label">shipment</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr01"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr02?.show">
          <div class="col-4 text-right searchbar-label">合同号</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr02"
              :readonly="listDataLoadingState">
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr03?.show">
          <div class="col-4 text-right searchbar-label">Mfg</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr03"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr04?.show">
          <div class="col-4 text-right searchbar-label">PDS Code</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr04"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr05?.show">
          <div class="col-4 text-right searchbar-label">产品备案批件号</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr05"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr06?.show">
          <div class="col-4 text-right searchbar-label">GroupID</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr06"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr07?.show">
          <div class="col-4 text-right searchbar-label">Division</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr07"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr08?.show">
          <div class="col-4 text-right searchbar-label">喷码有效期</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr08"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr09?.show">
          <div class="col-4 text-right searchbar-label">HS</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr09"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr10?.show">
          <div class="col-4 text-right searchbar-label">IB</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr10"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr11?.show">
          <div class="col-4 text-right searchbar-label">IB Item</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr11"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr12?.show">
          <div class="col-4 text-right searchbar-label">Size</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr12"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr13?.show">
          <div class="col-4 text-right searchbar-label">UPC</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr13"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr14?.show">
          <div class="col-4 text-right searchbar-label">Batch</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr14"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr15?.show">
          <div class="col-4 text-right searchbar-label">进境备案清单号</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr15"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr16?.show">
          <div class="col-4 text-right searchbar-label">备案序号</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr16"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr17?.show">
          <div class="col-4 text-right searchbar-label">批次属性17</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr17"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr18?.show">
          <div class="col-4 text-right searchbar-label">批次属性18</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr18"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr19?.show">
          <div class="col-4 text-right searchbar-label">批次属性19</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr19"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm" v-if="fpsInfo.filtersInfo?.LotAttr20?.show">
          <div class="col-4 text-right searchbar-label">OB合同创建日期</div>
          <div class="col-8">
            <q-input :hide-bottom-space="true" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              dense :maxlength="40" outlined square stack-label v-model="fpsReq.lotAttr20"
              :readonly="listDataLoadingState" >
              <template v-slot:append>
                <span>
                  ~
                  <q-tooltip max-width="180px" transition-hide="none" transition-show="none">
                    开头加上'~'表示使用模糊查询
                  </q-tooltip>
                </span>
              </template>
            </q-input>
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.labelingState?.show">
          <div class="col-4 text-right searchbar-label">贴标状态</div>
          <div class="col-8">
            <simple-filter-select :options="['未贴标', '已计划', '已上线', '已贴标', '无需贴标', '异常']"
              v-model="fpsReq.labelingState" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.releaseState?.show">
          <div class="col-4 text-right searchbar-label">放行状态</div>
          <div class="col-8">
            <simple-filter-select :options="['未放行', '已放行']"
              v-model="fpsReq.releaseState" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm"
          v-if="fpsInfo.filtersInfo?.caseState?.show">
          <div class="col-4 text-right searchbar-label">箱状态</div>
          <div class="col-8">
            <simple-filter-select :options="['正常', '销毁库', '员工库', '零头箱']"
              v-model="fpsReq.caseState" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
        <div v-if="fpsInfo.filtersInfo?.sampleState?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">留样状态</div>
          <div class="col-8">
            <easy-input v-model="fpsReq.sampleState" @focus="fx.ui.select" @keyup.enter="loadListData(2)"
              :readonly="listDataLoadingState"></easy-input>
          </div>
        </div>
        <div v-if="fpsInfo.filtersInfo?.urgentMark?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">加急标识</div>
          <div class="col-8">
            <q-toggle v-model="fpsReq.urgentMark" :disable="listDataLoadingState" dense
              @update:model-value="loadListData(2)" toggle-indeterminate />
          </div>
        </div>
        <div v-if="fpsInfo.filtersInfo?.sapStockType?.show"
          class="col-12 col-sm-6 col-md-4 col-lg-3 row q-col-gutter-sm">
          <div class="col-4 text-right searchbar-label">SAP库存锁定标识</div>
          <div class="col-8">
            <simple-filter-select :options="['S', 'Q', 'F']"
              v-model="fpsReq.sapStockType" :auto-select-single-option="false" :readonly="listDataLoadingState" />
          </div>
        </div>
      </div>
      <div class="row q-pt-sm">
        <div class="q-mr-sm">
          <q-btn :disable="listDataLoadingState" @click="loadListData(2)" color="primary" icon="search" label="查询" />
        </div>
        <div>
          <filter-options-cfg v-model:option-list="fpsInfo.filtersInfo"
            @update-filter-options-for-save="fpsAssist.saveFilterOptions">
          </filter-options-cfg>
        </div>
      </div>
    </div>
    <div class="shadow-2">
      <q-table :columns="fpsInfo.columnsInfo" :rows="$d.tableData" :hide-pagination="true" :loading="listDataLoadingState"
        v-model:pagination="fpsInfo.paginationInfo" :visible-columns="fpsInfo.visibleColumns" selection="multiple"
        row-key="invLocId" v-model:selected="$d.selectedItems"
        @request="fpsAssist.onDataTableRequest" binary-state-sort color="primary" dense flat separator="cell">
        <template v-slot:top="props">
          <!--功能按钮-->
          <div class="q-gutter-sm">
            <q-btn :disable="listDataLoadingState" @click="importInitInvs" color="primary" icon="fas fa-file-import"
              label="期初库存导入" v-if="fx.hasModifyRight('Wms.Inv.Inventory.ImportInitInvs')" />
            <q-btn label="回传SAP库存调整数据" color="primary" :disable="listDataLoadingState || $d.selectedItems.length===0"
              v-if="fx.hasModifyRight('Wms.Inv.Inventory.ReturnSapInventoryAdjustment')" @click="returnSapAdjustment"/>
          </div>
          <q-space />
          <q-btn @click="downloadInvLocListCsv" dense flat icon="save_alt" title="导出储位库存(csv压缩格式)" />
          <table-col-options-cfg v-model:visible-columns="fpsInfo.visibleColumns"
            v-model:table-columns="fpsInfo.columnsInfo" class="q-mx-sm"
            @update-col-options-for-save="fpsAssist.saveColOptions"></table-col-options-cfg>
          <q-btn :icon="props.inFullscreen ? 'fullscreen_exit' : 'fullscreen'" :ripple="false"
            :title="props.inFullscreen ? '退出全屏' : '全屏显示'" dense flat @click="props.toggleFullscreen" />
        </template>
        <!--操作列插槽-->
        <template v-if="fx.hasModifyRight('Wms.Inv.InvAdj.Edit')" v-slot:body-cell-operation="props">
          <q-td :props="props" auto-width>
            <q-btn class="btn-in-row q-mr-xs" color="primary" dense @click="showInvAdjListOfInvLoc(props.row)"
              label="调整" />
            <q-btn class="q-mr-xs btn-in-row" color="primary" dense label="冻结"
              @click="onFreezeOrUnFreeze(props.row, 'freeze', props.row.qty - props.row.qtyHold)"
              v-if="fx.hasModifyRight('Wms.Inv.Inventory.Freeze')" :disable="props.row.qty - props.row.qtyHold === 0" />
            <q-btn class="btn-in-row" color="primary" dense label="解冻"
              @click="onFreezeOrUnFreeze(props.row, 'unFreeze', props.row.qtyHold)"
              v-if="fx.hasModifyRight('Wms.Inv.Inventory.UnFreeze')" :disable="props.row.qtyHold === 0" />
          </q-td>
        </template>
        <template v-slot:no-data>
          <span class="full-width text-center"> <q-icon name="error_outline" /> 无数据 </span>
        </template>
        <!--描述-->
        <template v-slot:body-cell-descriptions="props">
          <q-td :props="props" auto-width>
            <q-btn icon="search" @click="showingDescriptions(props.row.descriptions)" color="primary" dense size="sm"
              :ripple="false" v-if="props.row.descriptions" />
            {{ props.row.descriptions }}
          </q-td>
        </template>
        <template v-slot:bottom>
          <paging-bar :loading-state="listDataLoadingState" :pageNo="fpsReq.pageNo" :pageSize="fpsReq.pageSize"
            :totalAmount="fpsInfo.totalAmount" @pagesize-changed="fpsAssist.onPageSizeChanged"
            @go-to-page="fpsNav.gotoPage" />
        </template>
        <template v-if="$d.tableData.length > 0" v-slot:bottom-row>
          <q-tr class="text-weight-bold">
            <q-td :key="index" v-for="(value, index) in summaryRowDispData">{{ value }}</q-td>
          </q-tr>
        </template>
        <template v-slot:body-cell-locState="props">
          <q-td :props="props" auto-width>
            <q-badge :color="props.row.locState === 'OK' ? 'positive' : 'negative'" :label="props.row.locState" />
          </q-td>
        </template>
      </q-table>
    </div>
    <q-dialog transition-hide="none" transition-show="none" v-model="showingFreezeUnfreezeDlg">
      <q-card style="max-width: 400px; width: 100%">
        <q-card-section class="q-pa-sm">
          <div class="text-h6" v-if="freezeUnfreezeDlgMode === 'freeze'">冻结数量</div>
          <div class="text-h6" v-if="freezeUnfreezeDlgMode === 'unFreeze'">解冻数量</div>
        </q-card-section>
        <q-separator />
        <!--错误提示-->
        <q-banner class="text-white bg-red q-mx-sm" dense inline-actions v-if="serverErrorMessageFreezeUnfreeze">
          {{ serverErrorMessageFreezeUnfreeze }}
          <template v-slot:action>
            <q-btn @click="serverErrorMessageFreezeUnfreeze = null" dense flat icon="close" size="sm" />
          </template>
        </q-banner>
        <div class="q-pa-sm">
          <q-icon color="red" name="fas fa-asterisk" size="10px" />
          <span>数量</span>
          <easy-input :maxlength="100" v-model="$d.formFreezeOrUnFreeze.qty" :error="v$.qty.$error"
            :error-message="e$(v$.qty.$errors)">
          </easy-input>
          <div class="q-mt-sm">
            <span>备注</span>
            <easy-input :maxlength="300" v-model="$d.formFreezeOrUnFreeze.remark" >
            </easy-input>
          </div>
        </div>
        <q-separator class="separator" />
        <q-card-actions align="right">
          <q-btn @click="doFreezeSubmit" color="primary" label="确定" :loading="freezeUnfreezeSubmittingState" />
          <q-btn color="primary" label="关闭" outline unelevated v-close-popup />
        </q-card-actions>
      </q-card>
    </q-dialog>
    <!--快速查看adj-->
    <q-dialog transition-hide="none" transition-show="none" v-model="dialogInvAdj">
      <q-card style="max-width: 1200px;width: 100%">
        <q-card-section class="q-pa-sm">
          <div class="text-h6">库存调整记录</div>
        </q-card-section>
        <div class="q-px-sm">
          <q-table :columns="columnsInvAdj" :rows="$d.tableDataInvAdjList" v-model:pagination="$d.paginationInvAdj"
            dense flat :hide-pagination="true" row-key="invAdj" separator="cell" :loading="invAdjListLoadingState"
            color="primary" table-style="height: 213px" class="q-mt-sm simple-border generic-sticky-header-table">
            <!--无数据提示-->
            <template v-slot:no-data>
              <span class="full-width text-center">
                <q-icon name="error_outline" /> 无数据
              </span>
            </template>
          </q-table>
        </div>
        <q-card-actions align="right">
          <q-btn @click="toCreateInvAdj" color="primary" label="新增调整" />
        </q-card-actions>
      </q-card>
    </q-dialog>
    <!--批量导入-->
    <q-dialog transition-hide="none" transition-show="none" v-model="confirmFile">
      <q-card style="max-width: 300px; width: 100%">
        <q-card-section class="q-pa-sm">
          <div class="text-h6">
            期初库存导入
            <a @click="fx.nw.downloadFile('/wms/res/download/init-inv-import-template.xlsx','',false)"
              class="text-body2" href="javascript:void(0)">导入模板下载</a>
          </div>
        </q-card-section>
        <q-separator />
        <!--错误提示-->
        <q-banner class="text-white bg-red q-mt-sm q-mx-sm" dense inline-actions v-if="serverErrorMessageImportExcel">
          {{ serverErrorMessageImportExcel }}
          <template v-slot:action>
            <q-btn @click="serverErrorMessageImportExcel = ''" dense flat icon="close" size="sm" />
          </template>
        </q-banner>
        <div class="q-pa-sm">
          <span>仓库</span>
          <simple-filter-select :auto-select-single-option="false" :options="$d.whDropdownList" @input="onWhChanged"
            option-label="whName" option-value="whId" v-model="whId" :use-filter="false" :readonly="caredLoading" />
          <input ref="locListExcelFileInput" type="file" class="q-pt-sm" />
        </div>
        <q-separator class="separator" />
        <q-card-actions align="right">
          <q-btn @click="importFile" color="primary" label="确定" :disable="!whId" />
          <q-btn color="primary" label="取消" unelevated v-close-popup outline />
        </q-card-actions>
        <q-inner-loading :showing="caredLoading">
          <q-spinner color="primary" size="50px" />
        </q-inner-loading>
      </q-card>
    </q-dialog>
    <!--描述弹框-->
    <q-dialog transition-hide="none" transition-show="none" v-model="showingDescriptionsDlg">
      <q-card style="max-width: 400px; width: 100%">
        <q-card-section class="q-pa-sm">
          <div class="text-h6">描述</div>
        </q-card-section>
        <q-separator />
        <!--描述内容-->
        <div class="q-pa-sm" v-html="showingDescriptionsContent">
        </div>
        <q-separator class="separator" />
        <q-card-actions align="right">
          <q-btn color="primary" label="关闭" outline unelevated v-close-popup />
        </q-card-actions>
      </q-card>
    </q-dialog>
  </q-page>
</template>
<script lang="ts">
export default {
  name: 'WmInvLocListStd'
}
</script>
<script lang="ts" setup>
import {invFieldOptionsDef} from '@njt/wms/defs/inventory/invloc'
import {computed, reactive, ref} from 'vue'
import {ColumnInfo, FilterInfo} from '@njt/foundation/defs/comm'
import {useFpsHelper} from '@njt/foundation/hooks/fpsHelper'
import {useTitleHelper} from '@njt/foundation/hooks/titleHelper'
import {WmWhLite} from '@njt/wms/defs/basic/wh'
import _ from 'lodash'
import useVuelidate from '@vuelidate/core'
import {CodeLineForDropdown, MfLite} from '@njt/foundation/helper/dropdownlist.d'
import {WmInvAdj, WmInvAdjLite} from '@njt/wms/defs/inventory/invadj'
import {WmLoc} from '@njt/wms/defs/basic/loc'
import WmSkuSelector from '@njt/wms/components/SkuSelector.vue'
import {WmZoneLite} from '@njt/wms/defs/basic/zone'
import {WmSkuLite} from '@njt/wms/defs/basic/sku'
import dayjs from 'dayjs'
import {GetMhlInvLocListReq, GetMhlInvLocListResp, MhlInvLocForList} from 'src/defs/invloc'

const pageTitle = '储位库存'
useTitleHelper(pageTitle)
// 弹框错误信息
let serverErrorMessageFreezeUnfreeze = ref('')
let listDataLoadingState = ref(false)
$f.fmt.prepareCountryFmt()
$f.fmt.prepareUomFmt()
// 导入相关
// 批量导入
let confirmFile = ref(false)
// 导入错误提示
let serverErrorMessageImportExcel = ref('')
// 仓库
let whId = ref('')
const columnsDefine: ColumnInfo[] = [
  {
    name: 'operation',
    label: '操作',
    field: 'operation',
    align: 'left',
    defOrder: 1,
    defVisible: true
  },
  {
    label: '储位库存ID',
    name: 'invLocId',
    field: 'invLocId',
    align: 'left',
    defOrder: 2,
    sortable: true,
    defVisible: true
  },
  {
    label: '仓库ID',
    name: 'whId',
    field: 'whId',
    align: 'left',
    defOrder: 3,
    defVisible: false
  },
  {
    label: '仓库名称',
    name: 'whName',
    field: 'whName',
    sortable: true,
    align: 'left',
    defOrder: 4,
    defVisible: true
  },
  {
    label: '货主ID',
    name: 'storerId',
    field: 'storerId',
    align: 'left',
    defOrder: 5,
    defVisible: false
  },
  {
    label: '货主名称',
    name: 'storerAbbrName',
    field: 'storerAbbrName',
    align: 'left',
    defOrder: 6,
    sortable: true,
    defVisible: true
  },
  {
    label: '储区ID',
    name: 'zoneId',
    field: 'zoneId',
    align: 'left',
    defOrder: 7,
    defVisible: false
  },
  {
    label: '储区名称',
    name: 'zoneName',
    field: 'zoneName',
    align: 'left',
    defOrder: 8,
    sortable: true,
    defVisible: true
  },
  {
    label: '储位ID',
    name: 'locId',
    field: 'locId',
    align: 'left',
    defOrder: 9,
    defVisible: false
  },
  {
    label: '储位编号',
    name: 'loc',
    field: 'loc',
    align: 'left',
    defOrder: 10,
    sortable: true,
    defVisible: true
  },
  {
    label: '栈板',
    name: 'lpn',
    field: 'lpn',
    align: 'left',
    defOrder: 11,
    sortable: true,
    defVisible: true
  },
  {
    label: '批号',
    name: 'lot',
    field: 'lot',
    align: 'left',
    defOrder: 12,
    sortable: true,
    defVisible: true
  },
  {
    label: '料号ID',
    name: 'skuId',
    field: 'skuId',
    align: 'left',
    defOrder: 13,
    defVisible: false
  },
  {
    label: '料号',
    name: 'sku',
    field: 'sku',
    align: 'left',
    defOrder: 14,
    sortable: true,
    defVisible: true
  },
  {
    label: '品名',
    name: 'skuName',
    field: 'skuName',
    align: 'left',
    defOrder: 15,
    defVisible: true
  },
  {
    label: '英文品名',
    name: 'skuNameE',
    field: 'skuNameE',
    align: 'left',
    defOrder: 16,
    defVisible: true
  },
  {
    label: '规格型号',
    name: 'spec',
    field: 'spec',
    align: 'left',
    defOrder: 17,
    defVisible: true
  },
  {
    label: '库存量',
    name: 'qty',
    field: 'qty',
    align: 'left',
    defOrder: 18,
    sortable: true,
    defVisible: true
  },
  {
    label: '已配置量',
    name: 'qtyAllocated',
    field: 'qtyAllocated',
    align: 'left',
    defOrder: 19,
    defVisible: true
  },
  {
    label: '已捡取量',
    name: 'qtyPicked',
    field: 'qtyPicked',
    align: 'left',
    defOrder: 20,
    defVisible: true
  },
  {
    label: '冻结量',
    name: 'qtyHold',
    field: 'qtyHold',
    align: 'left',
    defOrder: 21,
    defVisible: true
  },
  {
    label: '可用量',
    name: 'qtyAvailable',
    field: 'qtyAvailable',
    align: 'left',
    defOrder: 22,
    defVisible: true
  },
  {
    label: '描述',
    name: 'descriptions',
    field: 'descriptions',
    align: 'left',
    defOrder: 23,
    defVisible: true
  },
  {
    label: '入库日期',
    name: 'receivedDt',
    field: 'receivedDt',
    align: 'left',
    defOrder: 24,
    sortable: true,
    defVisible: true,
    format: (value: string | null) => $f.fmt.dtFmtDateOnly(value as string)
  },
  {
    label: '库龄(天)',
    name: 'invAges',
    field: 'invAges',
    align: 'left',
    defOrder: 25,
    defVisible: true
  },
  {
    label: '制造日期',
    name: 'dateCode',
    field: 'dateCode',
    align: 'left',
    defOrder: 26,
    sortable: true,
    defVisible: true
  },
  {
    label: '有效期',
    name: 'expiredDt',
    field: 'expiredDt',
    align: 'left',
    defOrder: 27,
    sortable: true,
    defVisible: true,
    format: (value: string) => $f.fmt.dtFmtDateOnly(value)
  },
  {
    label: '产地',
    name: 'coo',
    field: 'coo',
    align: 'left',
    defOrder: 28,
    sortable: true,
    defVisible: true,
    format: (value: string) => $f.fmt.country(value)
  },
  {
    label: '外部批号',
    name: 'vLot',
    field: 'vLot',
    align: 'left',
    defOrder: 29,
    sortable: true,
    defVisible: true
  },
  {
    label: '包装形态',
    name: 'packageType',
    field: 'packageType',
    align: 'left',
    defOrder: 30,
    sortable: true,
    defVisible: true,
    format: (value: string) => $f.fmt.fmtPackageType(value)
  },
  {
    label: '每箱数量',
    name: 'qtyPCase',
    field: 'qtyPCase',
    align: 'left',
    defOrder: 31,
    sortable: true,
    defVisible: true
  },
  {
    label: '每盒数量',
    name: 'qtyPIp',
    field: 'qtyPIp',
    align: 'left',
    defOrder: 32,
    sortable: true,
    defVisible: true
  },
  {
    label: '每内盒数量',
    name: 'qtyPIip',
    field: 'qtyPIip',
    align: 'left',
    defOrder: 33,
    sortable: true,
    defVisible: true
  },
  {
    label: '物料主分类',
    name: 'category',
    field: 'category',
    align: 'left',
    defOrder: 34,
    defVisible: false
  },
  {
    label: '物料次分类',
    name: 'subCategory',
    field: 'subCategory',
    align: 'left',
    defOrder: 35,
    defVisible: false
  },
  {
    label: '计量单位',
    name: 'uom',
    field: 'uom',
    align: 'left',
    defOrder: 36,
    defVisible: true,
    format: (value: string) => $f.fmt.uom(value)
  },
  {
    label: 'shipment',
    name: 'lotAttr01',
    field: 'lotAttr01',
    align: 'left',
    defOrder: 37,
    sortable: true,
    defVisible: true
  },
  {
    label: '合同号',
    name: 'lotAttr02',
    field: 'lotAttr02',
    align: 'left',
    defOrder: 38,
    sortable: true,
    defVisible: true
  },
  {
    label: 'Mfg',
    name: 'lotAttr03',
    field: 'lotAttr03',
    align: 'left',
    defOrder: 39,
    sortable: true,
    defVisible: true
  },
  {
    label: 'PDS Code',
    name: 'lotAttr04',
    field: 'lotAttr04',
    align: 'left',
    defOrder: 40,
    sortable: true,
    defVisible: true
  },
  {
    label: '产品备案批件号',
    name: 'lotAttr05',
    field: 'lotAttr05',
    align: 'left',
    defOrder: 41,
    sortable: true,
    defVisible: true
  },
  {
    label: 'GroupID',
    name: 'lotAttr06',
    field: 'lotAttr06',
    align: 'left',
    defOrder: 42,
    sortable: true,
    defVisible: true
  },
  {
    label: 'Division',
    name: 'lotAttr07',
    field: 'lotAttr07',
    align: 'left',
    defOrder: 43,
    sortable: true,
    defVisible: true
  },
  {
    label: '喷码有效期',
    name: 'lotAttr08',
    field: 'lotAttr08',
    align: 'left',
    defOrder: 44,
    sortable: true,
    defVisible: true
  },
  {
    label: 'HS',
    name: 'lotAttr09',
    field: 'lotAttr09',
    align: 'left',
    defOrder: 45,
    sortable: true,
    defVisible: true
  },
  {
    label: 'IB',
    name: 'lotAttr10',
    field: 'lotAttr10',
    align: 'left',
    defOrder: 46,
    sortable: true,
    defVisible: true
  },
  {
    label: 'IB Item',
    name: 'lotAttr11',
    field: 'lotAttr11',
    align: 'left',
    defOrder: 47,
    sortable: true,
    defVisible: true
  },
  {
    label: 'Size',
    name: 'lotAttr12',
    field: 'lotAttr12',
    align: 'left',
    defOrder: 48,
    sortable: true,
    defVisible: true
  },
  {
    label: 'UPC',
    name: 'lotAttr13',
    field: 'lotAttr13',
    align: 'left',
    defOrder: 49,
    defVisible: true
  },
  {
    label: 'Batch',
    name: 'lotAttr14',
    field: 'lotAttr14',
    align: 'left',
    defOrder: 50,
    sortable: true,
    defVisible: true
  }, {
    label: '进境备案清单号',
    name: 'lotAttr15',
    field: 'lotAttr15',
    align: 'left',
    defOrder: 51,
    sortable: true,
    defVisible: true
  },
  {
    label: '备案序号',
    name: 'lotAttr16',
    field: 'lotAttr16',
    align: 'left',
    defOrder: 52,
    sortable: true,
    defVisible: true
  },
  {
    label: '批次属性17',
    name: 'lotAttr17',
    field: 'lotAttr17',
    align: 'left',
    defOrder: 53,
    sortable: true,
    defVisible: true
  },
  {
    label: '批次属性18',
    name: 'lotAttr18',
    field: 'lotAttr18',
    align: 'left',
    defOrder: 54,
    sortable: true,
    defVisible: true
  },
  {
    label: '批次属性19',
    name: 'lotAttr19',
    field: 'lotAttr19',
    align: 'left',
    defOrder: 55,
    sortable: true,
    defVisible: true
  },
  {
    label: 'OB合同创建日期',
    name: 'lotAttr20',
    field: 'lotAttr20',
    align: 'left',
    defOrder: 56,
    sortable: true,
    defVisible: true
  },
  {
    label: '单件装量',
    name: 'qtyPEa',
    field: 'qtyPEa',
    align: 'left',
    defOrder: 57,
    defVisible: true
  },
  {
    label: '单件装量×数量',
    name: 'mol',
    field: 'mol',
    align: 'left',
    defOrder: 58,
    defVisible: true
  },
  {
    label: '储位状态',
    name: 'locState',
    field: 'locState',
    align: 'left',
    defOrder: 59,
    defVisible: true
  },
  {
    label: '贴标状态',
    name: 'labelingState',
    field: 'labelingState',
    align: 'left',
    defOrder: 60,
    defVisible: true
  },
  {
    label: '贴标上线时间',
    name: 'labelingBeginDt',
    field: 'labelingBeginDt',
    align: 'left',
    defOrder: 64,
    sortable: false,
    defVisible: true,
    format: (value: string) => $f.fmt.dtFmtFull(value)
  },
  {
    label: '实际贴标供应商',
    name: 'labelingSupplier',
    field: 'labelingSupplier',
    align: 'left',
    defOrder: 65,
    sortable: false,
    defVisible: true
  },
  {
    label: '贴标上线操作人',
    name: 'labelingBeginPn',
    field: 'labelingBeginPn',
    align: 'left',
    defOrder: 66,
    sortable: false,
    defVisible: true
  },
  {
    label: '贴标下线时间',
    name: 'labelingEndDt',
    field: 'labelingEndDt',
    align: 'left',
    defOrder: 67,
    sortable: false,
    defVisible: true,
    format: (value: string) => $f.fmt.dtFmtFull(value)
  },
  {
    label: '贴标下线操作人',
    name: 'labelingEndPn',
    field: 'labelingEndPn',
    align: 'left',
    defOrder: 68,
    sortable: false,
    defVisible: true
  },


  {
    label: '放行状态',
    name: 'releaseState',
    field: 'releaseState',
    align: 'left',
    defOrder: 69,
    defVisible: true
  },
  {
    label: '箱状态',
    name: 'caseState',
    field: 'caseState',
    align: 'left',
    defOrder: 70,
    defVisible: true
  },
  {
    label: '留样状态',
    name: 'sampleState',
    field: 'sampleState',
    align: 'left',
    defOrder: 71,
    defVisible: true
  },
  {
    label: '组号',
    name: 'labelingGroupNo',
    field: 'labelingGroupNo',
    align: 'left',
    defOrder: 72,
    sortable: false,
    defVisible: true
  },
  {
    label: '贴标异常上报时间',
    name: 'labelingAbnormalReportDt',
    field: 'labelingAbnormalReportDt',
    align: 'left',
    defOrder: 73,
    sortable: false,
    defVisible: true,
    format: (value: string) => $f.fmt.dtFmtFull(value)
  },
  {
    label: '贴标异常上报操作人',
    name: 'LabelingAbnormalReportpn',
    field: 'LabelingAbnormalReportpn',
    align: 'left',
    defOrder: 74,
    sortable: false,
    defVisible: true
  },
  {
    label: '贴标异常解除时间',
    name: 'LabelingAbnormalRemoveDt',
    field: 'LabelingAbnormalRemoveDt',
    align: 'left',
    defOrder: 75,
    sortable: false,
    defVisible: true,
    format: (value: string) => $f.fmt.dtFmtFull(value)
  },
  {
    label: '贴标异常解除操作人',
    name: 'LabelingAbnormalRemovePn',
    field: 'LabelingAbnormalRemovePn',
    align: 'left',
    defOrder: 76,
    sortable: false,
    defVisible: true
  },
  {
    label: '加急标识',
    name: 'urgentMark',
    field: 'urgentMark',
    align: 'left',
    defOrder: 77,
    defVisible: true,
    format: (value: boolean) => value === true ? '是' : value === false ? '否' : ''
  },
  {
    label: 'SAP库存锁定标识',
    name: 'sapStockType',
    field: 'sapStockType',
    align: 'left',
    defOrder: 78,
    defVisible: true
  },
]
const columnsInvAdj: ColumnInfo[] = [
  {
    label: '库存调整ID',
    name: 'adjId',
    field: 'adjId',
    sortable: true,
    align: 'left'
  },
  {
    label: '仓库名称',
    name: 'whName',
    field: 'whName',
    sortable: true,
    align: 'left'
  },
  {
    label: '货主名称',
    name: 'storerAbbrName',
    field: 'storerAbbrName',
    sortable: true,
    align: 'left'
  },
  {
    label: '调整原因',
    name: 'reason',
    field: 'reason',
    align: 'left'
  },
  {
    label: '状态',
    name: 'adjState',
    field: 'adjState',
    sortable: true,
    align: 'left'
  },
  {
    label: '审核时间',
    name: 'confirmDt',
    field: 'confirmDt',
    align: 'left'
  },
  {
    label: '审核人员',
    name: 'confirmPn',
    field: 'confirmPn',
    align: 'left',
    format: (confirmPn: string, row: WmInvAdjLite) => $f.fmt.userDisp(row.confirmP as string, confirmPn)
  },
  {
    label: '操作日期',
    name: 'operateDt',
    field: 'operateDt',
    align: 'left'
  },
  {
    label: '操作人员',
    name: 'operatePn',
    field: 'operatePn',
    align: 'left'
  },
  {
    label: '描述',
    name: 'descriptions',
    field: 'descriptions',
    align: 'left'
  },
  {
    label: '库存ID',
    name: 'invLocId',
    field: 'invLocId',
    align: 'left'
  },
  {
    label: '料号',
    name: 'sku',
    field: 'sku',
    align: 'left'
  },
  {
    label: '品名',
    name: 'skuName',
    field: 'skuName',
    align: 'left'
  },
  {
    label: '英文品名',
    name: 'skuNameE',
    field: 'skuNameE',
    align: 'left'
  },
  {
    label: '规格型号',
    name: 'spec',
    field: 'spec',
    align: 'left'
  },
  {
    label: '批号',
    name: 'lot',
    field: 'lot',
    sortable: true,
    align: 'left'
  },
  {
    label: '储区名称',
    name: 'zoneName',
    field: 'zoneName',
    sortable: true,
    align: 'left'
  },
  {
    label: '储位编号',
    name: 'loc',
    field: 'loc',
    align: 'left'
  },
  {
    label: '栈板',
    name: 'lpn',
    field: 'lpn',
    align: 'left'
  },
  {
    label: '调整数量',
    name: 'qty',
    field: 'qty',
    align: 'left'
  },
  {
    label: '调整净重(kg)',
    name: 'nw',
    field: 'nw',
    align: 'left'
  },
  {
    label: '调整毛重(kg)',
    name: 'gw',
    field: 'gw',
    align: 'left'
  },
  {
    label: '调整体积(m³)',
    name: 'cube',
    field: 'cube',
    align: 'left'
  },
]
// ==========冻结/解冻相关==========
// 修改数量弹窗
let showingFreezeUnfreezeDlg = ref(false)
// 提交状态
let freezeUnfreezeSubmittingState = ref(false)
// 状态
let freezeUnfreezeDlgMode = ref('')
// 用于表单验证的数值
let maxFreezeUnfreezeQty = ref(0)

interface paginationInvAdjDef {
  invLocId: number | null
  qty: number | null
  remark: string |null
}

let fpsReq: GetMhlInvLocListReq = reactive({
  sapStockType: null,
  urgentMark: null,
  invLocId: null,
  lot: null,
  lpn: null,
  whId: null,
  storerId: null,
  skuId: null,
  zoneId: null,
  locId: null,
  ifShowZeroInvItem: false,
  receivedDtBegin: null,
  receivedDtEnd: null,
  dateCode: null,
  expiredDtBegin: null,
  expiredDtEnd: null,
  coo: null,
  packageType: null,
  inboundType: null,
  vLot: null,
  qtyPEa: null,
  qtyPCase: null,
  qtyPIp: null,
  qtyPIip: null,
  lotAttr01: null,
  lotAttr02: null,
  lotAttr03: null,
  lotAttr04: null,
  lotAttr05: null,
  lotAttr06: null,
  lotAttr07: null,
  lotAttr08: null,
  lotAttr09: null,
  lotAttr10: null,
  lotAttr11: null,
  lotAttr12: null,
  lotAttr13: null,
  lotAttr14: null,
  lotAttr15: null,
  lotAttr16: null,
  lotAttr17: null,
  lotAttr18: null,
  lotAttr19: null,
  lotAttr20: null,
  pageNo: 1,
  pageSize: 40,
  isDescending: false,
  orderBy: null,
  companyId: null,
  labelingState: null,
  releaseState: null,
  caseState: null,
  sampleState: null,
})
const $d = reactive({
  tableData: [] as MhlInvLocForList[],
  selectedItems: [] as MhlInvLocForList[],
  // 产地下拉
  cooDropdownList: [] as CodeLineForDropdown[],
  // 入库方式下拉
  inboundTypeDropdownList: [
    {
      label: '无单',
      value: 'noDoc'
    },
    {
      label: '有单',
      value: 'withDoc'
    },
    {
      label: '期初',
      value: 'init'
    },
    {
      label: '调拨',
      value: 'trans'
    },
  ],
  actualFieldShown: {
    lot: {
      isShown: true
    },
    lpn: {
      isShown: true
    },
    ifShowZeroInvItem: {
      isShown: true
    } as invFieldOptionsDef
  },
  // 跳转携带数据
  invLocToCreateInvAdj: {} as WmInvAdjLite,
  whDropdownList: [] as WmWhLite[],
  //储区下拉仓库联动
  zoneDropdownListByWhId: [] as WmZoneLite[],
  // 储区下拉
  zoneDropdownList: [] as WmZoneLite[],
  locDropdownList: [] as WmLoc[],
  //解冻参数
  formFreezeOrUnFreeze: {
    invLocId: null,
    qty: null,
    remark: null
  } as paginationInvAdjDef,
  //库存调整列表数据
  tableDataInvAdjList: [] as WmInvAdjLite[],
  // 查看库存调整分页参数
  paginationInvAdj: {
    page: 1,
    rowsPerPage: 0
  },
  // 货主
  storerDropdownList: [] as MfLite[],
  // 汇总行数据
  summaryRowData: {
    qty: 0,
    qtyAllocated: 0,
    qtyPicked: 0,
    qtyHold: 0,
    qtyAvailable: 0,
  },
  filterOptionList: {
    lot: {
      label: '批号',
      show: true,
      order: 1
    },
    lpn: {
      label: '栈板',
      show: true,
      order: 2
    },
    ifShowZeroInvItem: {
      label: '显示已出库',
      show: true,
      order: 3
    },
    receivedDtBegin: {
      label: '入库日期从',
      show: false,
      order: 4
    },
    receivedDtEnd: {
      label: '入库日期至',
      show: false,
      order: 5
    },
    dateCode: {
      label: '制造日期',
      show: false,
      order: 6
    },
    expiredDtBegin: {
      label: '有效期从',
      show: false,
      order: 7
    },
    expiredDtEnd: {
      label: '有效期至',
      show: false,
      order: 8
    },
    coo: {
      label: '产地',
      show: false,
      order: 9
    },
    packageType: {
      label: '包装形态',
      show: false,
      order: 10
    },
    inboundType: {
      label: '入库方式',
      show: false,
      order: 11
    },
    vLot: {
      label: '外部批号',
      show: false,
      order: 12
    },
    qtyPEa: {
      label: '单件装量',
      show: false,
      order: 13
    },
    qtyPCase: {
      label: '每箱数量',
      show: false,
      order: 14
    },
    qtyPIp: {
      label: '每盒数量',
      show: false,
      order: 15
    },
    qtyPIip: {
      label: '每内盒数量',
      show: false,
      order: 16
    },
    LotAttr01: {
      label: 'shipment',
      show: false,
      order: 17
    },
    LotAttr02: {
      label: '合同号',
      show: false,
      order: 18
    },
    LotAttr03: {
      label: 'Mfg',
      show: false,
      order: 19
    },
    LotAttr04: {
      label: 'PDS Code',
      show: false,
      order: 20
    },
    LotAttr05: {
      label: '产品备案批件号',
      show: false,
      order: 21
    },
    LotAttr06: {
      label: 'GroupID',
      show: false,
      order: 22
    },
    LotAttr07: {
      label: 'Division',
      show: false,
      order: 23
    },
    LotAttr08: {
      label: '喷码有效期',
      show: false,
      order: 24
    },
    LotAttr09: {
      label: 'HS',
      show: false,
      order: 25
    },
    LotAttr10: {
      label: 'IB',
      show: false,
      order: 26
    },
    LotAttr11: {
      label: 'IB Item',
      show: false,
      order: 27
    },
    LotAttr12: {
      label: 'Size',
      show: false,
      order: 28
    },
    LotAttr13: {
      label: 'UPC',
      show: false,
      order: 29
    },
    LotAttr14: {
      label: 'Batch',
      show: false,
      order: 30
    },
    LotAttr15: {
      label: '进境备案清单号',
      show: false,
      order: 31
    },
    LotAttr16: {
      label: '备案序号',
      show: false,
      order: 32
    },
    LotAttr17: {
      label: '批次属性17',
      show: false,
      order: 33
    },
    LotAttr18: {
      label: '批次属性18',
      show: false,
      order: 34
    },
    LotAttr19: {
      label: '批次属性19',
      show: false,
      order: 35
    },
    LotAttr20: {
      label: 'OB合同创建日期',
      show: false,
      order: 36
    },
    labelingState: {
      label: '贴标状态',
      show: false,
      order: 37
    },
    releaseState: {
      label: '放行状态',
      show: false,
      order: 38
    },
    caseState: {
      label: '箱状态',
      show: false,
      order: 39
    },
    sampleState: {
      label: '留样状态',
      show: false,
      order: 40
    },
    urgentMark: {
      label: '加急标识',
      show: true,
      order: 41
    },
    sapStockType: {
      label: 'SAP库存锁定标识',
      show: true,
      order: 42
    }
  } as Record<string, FilterInfo>
})
let caredLoading = ref(false)
let locListExcelFileInput = ref()
// 批量导入确定
const importFile = function () {
  serverErrorMessageImportExcel.value = ''
  caredLoading.value = true
  let formData = new window.FormData()
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
  formData.append('dataFile', locListExcelFileInput.value.files[0])
  formData.append('whId', whId.value)
  $f.axios
    .post('/wms/inv/inventory/import-init-invs', formData)
    .then(() => {
      $f.ui.showNotifySucceeded('导入成功')
      confirmFile.value = false
      loadListData()
    })
    .catch((err) => {
      // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
      if (err.response?.data?.errorList?.length) {
        confirmFile.value = false
        // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
        $f.ui.showErrorListDlg(err?.response?.data)
      } else {
        serverErrorMessageImportExcel.value = $f.getAxiosErrMsg(err)
      }
    })
    .finally(() => {
      caredLoading.value = false
    })
}
const loadListData = function (resetFpsReq?: number) {
  if (resetFpsReq) {
    if (resetFpsReq >= 1) {
      fpsReq.pageNo = 1
    }
    if (resetFpsReq >= 2) {
      fpsReq.orderBy = ''
      fpsReq.isDescending = false
    }
  }
  listDataLoadingState.value = true
  $f.axios.get<GetMhlInvLocListResp>('/project/mhlbc/inv/inventory/get-inv-loc-list', {params: fpsReq})
    .then((result) => {
      $d.selectedItems = []
      $d.summaryRowData.qty = result.data.totalQty
      $d.summaryRowData.qtyAllocated = result.data.totalQtyAllocated
      $d.summaryRowData.qtyAvailable = result.data.totalQtyAvailable
      $d.summaryRowData.qtyPicked = result.data.totalQtyPicked
      $d.summaryRowData.qtyHold = result.data.totalQtyHold
      result.data.expiredDtBegin = $f.fmt.dtFmtDateOnly(result.data.expiredDtBegin)
      result.data.expiredDtEnd = $f.fmt.dtFmtDateOnly(result.data.expiredDtEnd)
      result.data.receivedDtBegin = $f.fmt.dtFmtDateOnly(result.data.receivedDtBegin)
      result.data.receivedDtEnd = $f.fmt.dtFmtDateOnly(result.data.receivedDtEnd)
      fpsAssist.handleGenericFpsResp(result.data)
      $d.tableData = result.data.mhlInvLocForList
      fpsAssist.saveFpsReq(fpsReq)
    })
    .catch((err) => {
      $f.ui.showNotifyFailed($f.getAxiosErrMsg(err))
    })
    .finally(() => {
      listDataLoadingState.value = false
    })
}

// 列表的汇总行显示
let summaryRowDispData = computed(() => {
  let dispData = [] as string[]
  _.forEach(columnsDefine, (col) => {
    if (_.indexOf(fpsInfo.visibleColumns, col.name) !== -1) {
      // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
      dispData.push($d.summaryRowData[col.field])
    }
  })
  return dispData
})

const validators = $f.validators
const rules = {
  qty: {
    required: validators.required,
    integer: validators.int32,
    greaterThan: validators.greaterThan(0),
    lessEqualThan: validators.lessEqualThan(maxFreezeUnfreezeQty)
  }
}
const v$ = useVuelidate(rules, computed(() => $d.formFreezeOrUnFreeze), {$autoDirty: true, $scope: false})
const {
  fpsInfo,
  fpsAssist,
  fpsNav,
  searchBarVisibility
} = useFpsHelper('/wms/inv/loc', null,
  null,
  null,
  fpsReq, columnsDefine,
  $d.filterOptionList,
  loadListData)
// 冻结/解冻按钮
const onFreezeOrUnFreeze = function (row: MhlInvLocForList, state: string, maxFreezeUnfreezeQt: number) {
  $d.formFreezeOrUnFreeze.qty = null
  $d.formFreezeOrUnFreeze.remark = null
  $d.formFreezeOrUnFreeze.invLocId = row.invLocId
  showingFreezeUnfreezeDlg.value = true
  freezeUnfreezeDlgMode.value = state
  maxFreezeUnfreezeQty.value = maxFreezeUnfreezeQt
}
// 冻结/解冻提交
const doFreezeSubmit = function () {
  serverErrorMessageFreezeUnfreeze.value = ''
  void v$.value
    .$validate()
    .then((valRes) => {
      if (valRes) {
        if (freezeUnfreezeDlgMode.value === 'freeze') {
          freezeUnfreezeSubmittingState.value = true
          $f.axios.post('/wms/inv/inventory/freeze-inventory', $d.formFreezeOrUnFreeze)
            .then(() => {
              loadListData()
              showingFreezeUnfreezeDlg.value = false
            })
            .catch((err) => {
              serverErrorMessageFreezeUnfreeze.value = $f.getAxiosErrMsg(err)
            })
            .finally(() => {
              freezeUnfreezeSubmittingState.value = false
              serverErrorMessageFreezeUnfreeze.value = ''
            })
        } else if (freezeUnfreezeDlgMode.value === 'unFreeze') {
          freezeUnfreezeSubmittingState.value = true
          $f.axios
            .post('/wms/inv/inventory/unfreeze-inventory', $d.formFreezeOrUnFreeze)
            .then(() => {
              loadListData()
              showingFreezeUnfreezeDlg.value = false
            })
            .catch((err) => {
              serverErrorMessageFreezeUnfreeze.value = $f.getAxiosErrMsg(err)
            })
            .finally(() => {
              freezeUnfreezeSubmittingState.value = false
              serverErrorMessageFreezeUnfreeze.value = ''
            })
        }
      }
    })
}
let invAdjListLoadingState = ref(false)
let dialogInvAdj = ref(false)
// 调整按钮
const showInvAdjListOfInvLoc = function (row: WmInvAdj) {
  $d.tableDataInvAdjList = []
  invAdjListLoadingState.value = true
  $d.invLocToCreateInvAdj = {
    invLocId: row.invLocId,
    whName: row.whName,
    whId: row.whId,
    storerAbbrName: row.storerAbbrName,
    storerId: row.storerId,
    skuId: row.skuId,
    sku: row.sku,
    skuName: row.skuName,
    skuNameE: row.skuNameE,
    lot: row.lot,
    zoneName: row.zoneName,
    zoneId: row.zoneId,
    loc: row.loc,
    locId: row.locId,
    lpn: row.lpn,
    confirmDt: row.confirmDt as Date,
    operateDt: row.operateDt as Date,
    confirmP: null,
    confirmPn: null
  }
  dialogInvAdj.value = true
  $f.axios
    .get<WmInvAdjLite[]>('/wms/inv/inventory/get-inv-adjs-by-inv-loc-id/' + String(row.invLocId))
    .then((resp) => {
      let data = resp.data
      _.forEach(data, (v) => {
        v.confirmDt = $f.fmt.dtFmtFull(v.confirmDt)
        v.operateDt = $f.fmt.dtFmtFull(v.operateDt)
      })
      $d.tableDataInvAdjList = data
    })
    .catch((err) => {
      $f.ui.showNotifyFailed($f.getAxiosErrMsg(err))
    })
    .finally(() => {
      invAdjListLoadingState.value = false
    })
}

const returnSapAdjustment = function () {
  void $f.ui.messageBox({
    caption: '操作确认',
    text: '是否执行回传SAP库存调整数据操作？',
    icon: 'Question',
    buttons: 'OkCancel',
    delayClose: true
  }).then((btn) => {
    if (btn === 'ok') {
      $f.axios
        .post('/project/mhlbc/inv/inventory/return-sap-inventory-adjustment',_.map($d.selectedItems, 'invLocId'))
        .then(() => {
          $f.ui.closeMsgBox()
          loadListData(2)
          $f.ui.showNotifySucceeded('执行成功')
        })
        .catch((err) => {
          void $f.ui.messageBox({
            caption: '执行失败',
            text: $f.getAxiosErrMsg(err),
            icon: $f.getAxiosErrIcon(err),
            buttons: 'Close'
          })
        })
    }
  })
}

// 批量导入
const importInitInvs = function () {
  confirmFile.value = true
  serverErrorMessageImportExcel.value = ''
  whId.value = ''
}
let showingDescriptionsContent = ref('')
let showingDescriptionsDlg = ref(false)
// 描述弹框
const showingDescriptions = function (value: string) {
  showingDescriptionsContent.value = ''
  showingDescriptionsDlg.value = true
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
  if (value) showingDescriptionsContent.value = value.replaceAll(';', '<br />')
}
// 仓库变更
const onWhChanged = function (value: number) {
  fpsReq.zoneId = null
  fpsReq.locId = null
  void $f.lst.getZoneSimpleList(value)
    .then((resp) => {
      $d.zoneDropdownListByWhId = resp.zones
    })
}

// 货主变更
const onStorerChanged = function () {
  fpsReq.skuId = null
  fpsReq.sku = null
}
// 料号选择器返回
const onSkuSelected = function (skuInfo: WmSkuLite) {
  fpsReq.sku = skuInfo?.sku ?? null
  fpsReq.skuId = skuInfo?.skuId ?? null
}

const toCreateInvAdj = function () {
  void $f.router.push({
    name: '/wms/inv/adj/create',
    state: {invLocToCreateInvAdj: JSON.stringify($d.invLocToCreateInvAdj)}
  })
}

const downloadInvLocListCsv = function () {
  void $f.ui.messageBox({
    caption: '操作确认',
    text: '导出库存(csv压缩格式)可能会消耗较多时间和资源，尽量不要在系统繁忙的时候执行此动作，确认继续吗?',
    icon: 'Warning',
    buttons: 'OkCancel',
    delayClose: true
  }).then((btn) => {
    if (btn === 'ok') {
      let timeStamp = Date.now()
      let formattedString = dayjs(timeStamp).format('YYYYMMDDHHmmss')
      let fileName = 'Csv_' + formattedString + '.xlsx'
      let params = $f.misc.makeSimpleQueryObj(fpsReq, [], {pageNo: 1, pageSize: 0x7fffffff})
      let url = $f.misc.makeUrlWithQueryParam('/project/mhlbc/inv/inventory/get-inv-loc-list-csv', params)
      $f.nw.downloadFileWithAuth(url, fileName, false)
      $f.ui.closeMsgBox()
    }
  })
}

const onZoneChanged = function () {
  // 储区变更
  fpsReq.locId = null
}

// 获取仓库下拉数据源
void $f.lst.getWmWhSimpleList()
  .then((resp) => {
    $d.whDropdownList = resp
  })
// 储区数据源
void $f.lst.getZoneSimpleList(null)
  .then((resp) => {
    $d.zoneDropdownList = resp.zones
  })
//获取货主下拉数据源
void $f.lst.getMfSimpleList({isStorer: true})
  .then((resp) => {
    $d.storerDropdownList = resp.mfLiteList
  })
//产地下拉
void $f.lst.getCodeForDropdown('Country')
  .then((resp) => {
    $d.cooDropdownList = resp
  })

const fx = $f
const e$ = $f.getFieldErrStr
</script>
